﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KNXObjects
{
    public class ValueObject32 : GenericObjectBase<double>
    {
        #region ObjectBase Implementations

        public override string DataPointEISName
        {
            get { return string.Empty; }
        }

        public override string DataPointID
        {
            get { return "14.xxx"; }
        }

        public override string ToString()
        {
            return Value.ToString("#.########");
        }
        #endregion

        #region ctor

        public ValueObject32(string id, string address, string name, string flags)
            : base(id, address, name, flags)
        {
        }

        public ValueObject32(string value)
        {
            SetValue(value);
        }

        #endregion

        public override void SetValue(string value)
        {
            double val;
            if (!double.TryParse(value, out val))
                throw new ApplicationException("ValueObject32: cannot parse input value to double. Val : " + value);
            Value = val;
        }
    }
}
